package com.wangs.test;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

public class JsonZHhDemo {
    public static void main(String[] args) {
        String str = "{\"name\":\"汪涛\",\"age\":\"22\",\"ary\":[1,2,3,4]}";
        JSONObject jsonobject = JSONObject.fromObject(str);
        String strs = jsonobject.toString();

        System.out.println(str);
        System.out.println(strs);

        String strss = "{\"keys\":11,\"age\":\"22\"}";
        JSONObject jsonobject1 = JSONObject.fromObject(strss);
        int a = jsonobject1.getInt("keys");
        String age = jsonobject1.getString("age");

        JSONArray ary = jsonobject1.getJSONArray("ary");

        System.out.println(a);
        System.out.println(age);
        System.out.println(ary);

    }
}
